//
//  SectionV.swift
//  Employee
//
//  Created by swordjoy on 2017/3/29.
//  Copyright © 2017年 remotevillage. All rights reserved.
//

import UIKit

class SectionV: UIView {
  
  var title: String = "" {
    didSet {
      titleLabel.text = title
    }
  }
  
  var titleColor: UIColor = UIColor.clear {
    didSet {
      titleLabel.textColor = titleColor
    }
  }
  
  fileprivate var contentV: UIView!
  fileprivate var titleLabel: UILabel!
  
  override init(frame: CGRect) {
    super.init(frame: frame)
    backgroundColor = UIColor.clear
    
    create()
  }
  
  required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }
}

// MARK: - fileprivate

extension SectionV {
  fileprivate func create() {
    contentV = UIView(frame: bounds)
    addSubview(contentV)
    contentV.backgroundColor = GlobalConfig.BGWhiteColor
    
    titleLabel = UILabel()
    contentV.addSubview(titleLabel)
    titleLabel.font = GlobalConfig.system16Font
    titleLabel.textColor = GlobalConfig.TextDeepColor
    titleLabel.snp.makeConstraints { (make) in
      make.left.equalTo(10)
      make.centerY.equalToSuperview()
    }
  }
}
